package com.rocketmq.consumer;

import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 延时消息
 * @author ytj
 * @date 2024/10/12 10:55
 */
@Component
@RocketMQMessageListener(consumerGroup = "delay-product",topic = "delay_topic")
public class DelayMessageTest implements RocketMQListener<MessageExt> {
    @Override
    public void onMessage(MessageExt messageExt) {
        System.out.println("接收到消息时间为:"+new Date()+",消息内容为:"+new String(messageExt.getBody()));
    }
}
